﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using e77.Ud2;
using Szakdolgozat.Screens;
using System.Collections.ObjectModel;

namespace Szakdolgozat
{
    /// <summary>
    /// Interaction logic for MeasureView.xaml
    /// </summary>
    public partial class MeasureView : UserControl
    {
        MainWindow mainWindow;
        Controller controller = new Controller();
        Database database = new Database();
        public ObservableCollection<Controller.Data> List { get; set; }

        public MeasureView(MainWindow mainWindow)
        {
            this.mainWindow = mainWindow;
            List = new ObservableCollection<Controller.Data>();
            InitializeComponent();
        }

        private void backButton_Click(object sender, RoutedEventArgs e)
        {
            mainWindow.contentControl1.Content = new MainMenuView(mainWindow);
        }

        private void measureButton_Click(object sender, RoutedEventArgs e)
        {
            controller.Measure(sampleIDtextbox.Text, patientIDtextbox.Text, stripLOTtextbox.Text);
            List.Clear();
            foreach (var item in controller.GetResults(sampleIDtextbox.Text))
                List.Add(item);         
            mainWindow.contentControl1.Content = new LastResultView(mainWindow, List);
        }

    }
}
